import 'dart:convert';
import 'dart:async';
//import 'package:flutterxc/module/travel_model.dart';
import 'package:flutterxc/module/travel_tab_model.dart';
import 'package:flutterxc/module/travel_tab_model2.dart';
import 'package:http/http.dart' as http;
//import 'package:flutterxc/module/Home_module.dart';
//const Travel_URL = 'http://www.devio.org/io/flutter_app/json/travel_page.json';
const Travel_URL = 'https://m.ctrip.com/restapi/soa2/15612/json/getTripShootHomePage?_fxpcqlniredt=09031148311422599651&__gw_appid=99999999&__gw_ver=1.0&__gw_from=10650013707&__gw_platform=H5';
class TravelTabDao {
  static Future<TravelTabModel2> fetch()async {
    final response = await http.get(Travel_URL);
    if(response.statusCode == 200){
      var res = json.decode(Utf8Decoder().convert(response.bodyBytes));
//        print('$res res666');
      return TravelTabModel2.fromJson(res);
    }else {
      throw Exception('一个未知的错误');
    }
  }
}